<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('管理费列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <div style="height: 30px;width: 800px;background-color: rgba(204, 204, 204, 1);line-height: 30px">
                    <span style="margin-left: 20px;font-weight: bold">历史缴纳记录：</span>
                </div>

                <div style="height: 30px;width: 800px;line-height: 30px;margin-left: 20px;">
                    免缴纳月份：<span id="mjMonth"></span>
                    <a href="#" onclick="show()">修改</a>
                </div>

                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <p>年：</p>
                                <input type="text" name="costYear"/>
                            </li>
                            <li>
                                <p>月份：</p>
                                <select name="costMonth" th:with="type=${@dict.getType('sys_normal_disable')}">
                                    <option value="-1">全年</option>
                                    <option value="1">1</option>
                                    <option value="2">2</option>
                                    <option value="3">3</option>
                                    <option value="4">4</option>
                                    <option value="5">5</option>
                                    <option value="6">6</option>
                                    <option value="7">7</option>
                                    <option value="8">8</option>
                                    <option value="9">9</option>
                                    <option value="10">10</option>
                                    <option value="11">11</option>
                                    <option value="12">12</option>
                                </select>
                            </li>
                            <li>
                                <p>主持人：</p>
                                <input type="text" name="costHostName"/>
                            </li>
                            <li>
                                <select name="costPaystate" th:with="type=${@dict.getType('sys_normal_disable')}">
                                    <option value="-1">缴纳状态</option>
                                    <option value="0">已正常缴纳</option>
                                    <option value="1">待缴纳</option>
                                    <option value="2">待缴纳，一级延迟</option>
                                    <option value="3">待缴纳，二级延迟</option>
                                    <option value="4">已缴纳，一级延迟</option>
                                    <option value="5">已缴纳，二级延迟</option>
                                </select>
                            </li>
                            <li>
                                <div id= "div1" style="height: 30px;width: 800px;line-height: 30px">

                                </div>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;筛选</a>
                            </li>
                        </ul>
                    </div>
                </form>

            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="other:cost:export">
                    <i class="fa fa-download"></i> 数据导出
                 </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('other:cost:edit')}]];
        var removeFlag = [[${@permission.hasPermi('other:cost:remove')}]];
        var prefix = ctx + "other/cost";

        $(function() {
            $.post(prefix+"/findDate",function (result) {
                $("#div1").append('<span style="margin-left: 20px;">已查询到'+result.recordNum+'条记录，查询到应交金额'+result.shouldNum+'元，已缴金额'+result.alreadNum+'元</span>');
            });

            $.post(prefix+"/findMjMonth",function (result) {
                //alert(result);
                var i;
                for(i in result){
                    if(result[i]!=","){
                        $("#mjMonth").append(result[i]+"月 ");
                    }
                }
            });

            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "管理费",
                columns: [
                {
                    field : 'costId', 
                    title : '编号',
                    align: 'center'
                    //visible: false
                },
                {
                    field : 'costHostid', 
                    title : '主持人ID',
                    align: 'center',
                    visible: false
                },
                {
                    field : 'costHostName', 
                    title : '主持人名字',
                    align: 'center'
                },
                {
                    field : 'costMoney', 
                    title : '管理费',
                    align: 'center'
                },
                {
                    field : 'costOverdue', 
                    title : '滞纳金',
                    align: 'center'
                },
                {
                    field : 'shouldCost',
                    title : '应交额度',
                    align: 'center',
                    formatter: function (value,row,index) {
                        //alert(row.costOverdue);
                        var shouldCost = row.costMoney+row.costOverdue;
                        return shouldCost;
                    }
                },
                {
                    field : 'costPaystate',
                    title : '缴纳状态',
                    align: 'center',
                    formatter: function (value, row, index) {
                        if(value == 0){
                            return "<span>已正常缴纳</span>";
                        }
                        if (value == 1) {
                            return "<span style='color: red'>待缴纳</span>";
                        }
                        if (value == 2) {
                            return "<span style='color: red'>待缴纳，一级延迟</span>";
                        }
                        if (value == 3) {
                            return "<span style='color: red'>待缴纳，二级延迟</span>";
                        }
                        if (value == 4) {
                            return "<span>已缴纳，一级延迟</span>";
                        }
                        if (value == 5) {
                            return "<span>已缴纳，二级延迟</span>";
                        }
                    }
                },
                {
                    field : 'costPaytime', 
                    title : '缴纳时间',
                    align: 'center',
                    formatter: function (value, row, index) {
                        if(value == null || value == ""){
                            return "<span style='text-align: center'>----</span>";
                        }else {
                            return value;
                        }
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.costHostid + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.costId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

        function show() {
            $.modal.open("管理费免缴月份", "/other/cost/showMjmonth");
        }
    </script>
</body>
</html>